package com.yourcom.proname.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

@Configuration
public class Interceptor implements WebMvcConfigurer {

    @Resource
    HandlerInterceptor loginAuthInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //添加一个拦截器，判断权限，排除掉登录接口和注册接口
        registry.addInterceptor(loginAuthInterceptor)
                .excludePathPatterns("/user/login","/user/register");
    }
}
